#!/usr/bin/env bash
# Copyright 2019 GSI, Inc. All rights reserved.
#
#

OS=$(uname -s 2>&1)
if [ "$OS" == "Linux" ]; then
   export LD_LIBRARY_PATH=$DDS_LIBS_LOCATION:$LD_LIBRARY_PATH
fi
if [ "$OS" == "Darwin" ]; then
   export DYLD_LIBRARY_PATH=$DDS_LIBS_LOCATION:$DYLD_LIBRARY_PATH
fi

# %DDS_USER_ENVIRONMENT%

# Run user process in background to prevent propogation of the signals
# Otherwise user task will catch the signals sent to the wrapper
# %DDS_USER_TASK% &

# Wait for user task to finish
USERTASK_PID=$!
wait $USERTASK_PID
USER_TASK_EXIT_CODE=$?

exit $USER_TASK_EXIT_CODE
